let mongoose = require("mongoose"),
    db = mongoose.connection,
    noteSchema = new mongoose.Schema({
      title:{type:String , required:true},
      content:{type:String},
      classId:{type:String , required:true},
      isDel:{type:Number , default:2},
      pubdate:{type:Number , default:(new Date()).valueOf()},
      brief:{type:String},
    });
    noteS = db.model("note" , noteSchema),
    note = {
      add(Conditions , callback){
        noteS.create(Conditions , callback);
      },
      get(Conditions , callback){
        noteS.find(Conditions , callback);
      },
      remove(Conditions , callback){
        noteS.remove(Conditions , callback);
      },
      update(Conditions , data , callback){
        noteS.update(Conditions , data , callback);
      }
    };

module.exports = note;
